< previous page page_742 next page >

Page 742
Type.gifListing 19.16. Adding the SaveRow method.
Private Sub SaveRow(strRow As String)
    '
    ' save row to rtb control
    '
    frmSQLData.rtbSQLData.Text = frmSQLData.rtbSQLData.Text & strRow & vbCrLf
    '
End Sub
Now that you have loaded the rich textbox control with the data from the data source, you need a routine that moves individual rows from the control to the caller's input controls on the data-entry form. To do this, you need some support routines: the GetSQLRec and GetSQLField methods. Add the code in Listing 19.17 to your class.
Type.gifListing 19.17. Coding the GetSQLRec method.
Private Sub GetSQLRec(intLine As Integer, strLine As String, frmTemp As Object)
    '
    ' move a rec from the rtb into array
    '
    Dim intLoop As Integer
    Dim lngPosMark As Long
    Dim lngRecEnd As Long
    Dim intRec As Integer
    Dim strData As String
    '
    strData = frmSQLData.rtbSQLData.Text
    '
    lngPosMark = 1
    For intLoop = 1 To intRecordCount
        lngPosMark = InStr(lngPosMark, strData, "||")
        If lngPosMark <> 0 Then
            intRec = intRec + 1
            If intRec = intLine Then
                Exit For
            End If
            lngPosMark = lngPosMark + 1
        End If
    Next
    '
    If intRec <> 0 Then
       lngRecEnd = InStr(lngPosMark, strData, vbCrLf)
       strLine = Mid(strData, lngPosMark + 2, lngRecEnd - (lngPosMark + 2))
    End If
    '
    ' now get fields
    If strLine <> "" Then
        For intLoop = 1 To NumCols
            frmTemp.sqlfield(intLoop - 1) = GetSQLField((strLine), intLoop)
'frmTemp.sqlfield(intLoop) = GetSQLField(strRecLine, intLoop)

 
< previous page page_742 next page >

If you like this book, buy it!